import pandas as pd

import backEnd.database.DBOperation as DBOperation
from datetime import datetime


def login_check(username, password, identify):
    db = DBOperation.db_Operation()
    if identify == "Admin":
        re, df = db.selectAll("administrator")
        result = df[(df['name'] == username) & (df['password'] == password)]
        is_found = not result.empty
        return is_found, result.values.tolist()
    else:
        re, df = db.selectAll("account")
        result = df[(df['name'] == username) & (df['password'] == password)]
        is_found = not result.empty
        return is_found, result.values.tolist()
